CodeGear - Where Developers Matter
NEWS

Oct 29, 2008 - HTMLEdit 3.0 Updated

View Changes.

Sep 22, 2008 - HTMLEdit 3.0 Updated

View Changes.

Aug 15, 2008 - HTMLEdit 3.0 Updated

View Changes.

July 18, 2008 - HTMLEdit 3.0 Updated

View Changes.

Custom Tags

Custom tags can be used by applications that use HTMLedit to replace parts of a document with HTML code provided by the application during streaming of the HTML document. This article describes the general concept behind custom tags by showing how they are used in the Brazil FAQ Manager

At Purposesoft we are using the Brazil FAQ Manager to maintain our FAQs on purposesoft. Our FAQ entries oftentimes contain pascal source code that should be properly layouted on our website. But formatting and highlighting source code manually in HTML is not an enjoyable experience. That's where custom tags come into play. The FAQ Manager uses the custom tag "brazil:sourcecode" to store a piece of source code in an HTML document in a simple binary format (see screenshot below).


Pascal source code encoded
in HTML using custom tags

 

HTMLEdit provides events that are fired when the document is loaded and saved. These event handlers provide the application developer with a means to insert valid HTML code into the document. In the example of the FAQ Manager the binary block of source code is replaced by an image representing the source code (see screenshot below). When the user double-clicks this image then a new window pops up showing the content of the custom tag, i.e. the pascal source code. The user can comfortably edit the source code in text form without having to manually layout the source code in HTML.


After loading the source code is replaced by
an image representing the source code

 

When the user is finished editing the FAQ entry then he sends the HTML document to the webserver. At this point in time the document again contains the binary-encoded source code embedded in a custom tag. It is stored in the FAQ database on the webserver. Whenever a customer views an FAQ entry then an ISAPI DLL on the webserver parses the source code custom tags and passes them on to a component which generates syntactically highlighted HTML code (see screenshot below).


The FAQ entry in HTML form
as the customer sees it

 

Other applications

Custom tags can be useful in a variety of scenarios. For example, when you have a large number of documents that all contain a standard header or footer and you don't want to store the content of these blocks in the document itself then you could use a custom tag to store a reference into a database or file where your header is located. This way changes in your header do not result in you having to update all documents that use the header.